package com.qf.medicaldoctoradmin.onlineSigning.nearbyMechanism.controller;

import com.qf.common.annotation.NoLoginCheck;
import com.qf.common.common.R;
import com.qf.medicaldoctoradmin.onlineSigning.nearbyMechanism.vo.OrganizationVO;
import com.qf.medicaldoctoradmin.onlineSigning.nearbyMechanism.vo.SearchVO;
import com.qf.medicaldoctoradmin.onlineSigning.nearbyMechanism.service.OrganizationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@Api(tags = "附近机构")
@RequestMapping("nearby")
@CrossOrigin
public class OrganizationController {
    @Resource
    private OrganizationService organizationService;

    /**
     *查询附近机构的列表，展示
     * @return
     */
    @GetMapping("/select")
    @ApiOperation(value = "展示机构", notes = "附近机构页面")
    public R selectList(){
        List<OrganizationVO> list = organizationService.selectList();
        return R.ok(list);
    }

    /**
     * 字段搜索医生和机构，模糊查询
     * @param keyword
     * @return
     */
    @GetMapping("/selectByName")
    @ApiOperation(value = "搜索", notes = "搜索医生/机构")
    public R selectByName(@RequestParam("keyword") String keyword){
        List<SearchVO> list = organizationService.searchByName(keyword);
        return R.ok(list);
    }
}
